{% extends "contest/base.html" %}
{% load i18n %}
{% block extrahead  %}
<script type="text/javascript" src="/static/javascript/display-list.js"></script>
{% endblock %}

{% block title %}
    Global Ranking
{% endblock %}

{% block content %}
    {% if categories %}
    <ul>
        <li id="slopes" class='ranking_list span-17'>
            {% if slopes %}
            <h3 class="prepend-1">{% trans "Slopes" %}</h3>
            <table class="ranking append-top">
                <thead>
                    <tr>
                        <th class="numbers">{% trans "Ranking" %}</th>
                        <th class="numbers">{% trans "Numero" %}</th>
                        <th class="numbers">{% trans "Value" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for slope in slopes %}
                    <tr class="{% cycle 'alt' 'normal' %}">
                        <td class="numbers">{{ forloop.counter }}</td>
                        <td class="numbers">{{slope.number}}</td>
                        <td class="numbers">{{slope.score}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% endif %}
        </li>
        {% for category in categories %}
        <li id='{{category.id}}' class='ranking_list span-17'>
            <h3 class="prepend-1">{{category.name}}</h3>
            <table class="ranking append-top">
                <thead>
                    <tr>
                        <th class="numbers">{% trans "Ranking" %}</th>
                        <th class="numbers">{% trans "Number" %}</th>
                        <th class="names">{% trans "Name Surname" %}</th>
                        <th>{% trans "Score" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for competitor in category.rank_competitors %}
                    <tr class="{% cycle 'alt' 'normal' %}">
                        <td class="ranking">{{ forloop.counter }}</td>
                        <td>{{competitor.number}}</td>
                        <td class="names"><a href="{% url competitor competitor.id %}"> 
                            {{competitor.name}} {{competitor.surname}}</a></td>
                        <td>{{competitor.score}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </li>
        {% endfor %}
    </lu>
    {% else %}
        <p>No Categories found</p>
    {% endif %}
{% endblock %}